Repository navigation
feat(cli): name the next command in scope, credential, and login errors - #24
Merged
Merged
Conversation
This was referenced Oct 13, 2026
thebrandonlucas
force-pushed
the
feat/cli-error-hints
branch
from
October 19, 2026 13:14
59c4f38 to
b8f54fd
Compare
thebrandonlucas
force-pushed
the
feat/cli-error-hints
branch
2 times, most recently
from
October 19, 2026 13:47
c77c34d to
3e49448
Compare
thebrandonlucas
force-pushed
the
feat/cli-error-hints
branch
from
October 19, 2026 18:25
3e49448 to
6fd4bcb
Compare
thebrandonlucas
force-pushed
the
feat/cli-error-hints
branch
4 times, most recently
from
October 19, 2026 19:19
0d3964a to
ed7d51a
Compare
This was referenced Oct 19, 2026
thebrandonlucas
force-pushed
the
feat/cli-error-hints
branch
from
October 20, 2026 00:20
ed7d51a to
b793cee
Compare
thebrandonlucas
force-pushed
the
feat/cli-error-hints
branch
from
October 20, 2026 11:58
b793cee to
f87afaf
Compare
thebrandonlucas
changed the base branch from
feat/cli-interactive-pickers
to
test/cli-picker-failures
October 20, 2026 11:59
tee8z
self-requested a review
October 20, 2026 12:15
tee8z
reviewed
Oct 20, 2026
Contributor
There was a problem hiding this comment.
This is looking good! The robot has a bit of feedback around a few missed hints and error paths.
Specifically:
Most of the robots comments are cases where a hint names a fix that doesn't work for the credential or flags in use (--profile with VOLTAGE_WALLET_ID, API keys with organizations list, voltage login with a saved login), plus two places where human error output now drops information it used to show. Each comment has a suggestion. It read the code but didn't run it.
thebrandonlucas
force-pushed
the
feat/cli-error-hints
branch
from
October 20, 2026 12:25
f87afaf to
a9590c7
Compare
Errors for a missing --org, --env, --wallet, or webhook ID now name the command that lists those IDs and every way to supply one. The organization and environment listings are marked browser login only, and the wallet hint says VOLTAGE_WALLET_ID is read only without --profile. An unknown or ambiguous credential or profile lists the saved names. organizations list and environments list with an API key say which key was used and how to select a browser login. An expired or revoked login (OAuth invalid_grant) says so, at refresh and at the organization token exchange, and gives the voltage logout --local and voltage login commands that replace it. The commands quote the account name for the shell and repeat --auth-url when the login is not on the default auth service, since that flag is never saved. API rejections carry a next step, also when the body is not JSON. HTTP 401, and the HTTP 400 missing_credentials the API returns for a key it does not recognize, point to voltage auth status; for a login the hint also gives the commands that sign in again. HTTP 403 points to voltage context. For a checkout session or stream token, both point to the token in --token-file, VOLTAGE_CHECKOUT_TOKEN, or VOLTAGE_STREAM_TOKEN. quote_required points to voltage quotes create and notes that a wallet on a BTC line of credit needs no quote. Hints can now be built at runtime and are scrubbed like messages, since they can name saved credentials. A 4xx rejection's message leads with the API's own reason, such as "Quote is required for payment", instead of only the HTTP status. A 5xx message gives only the status, and its text stays in the details. The presented credentials are redacted from the message as well as the details, so an API reason that echoes a key cannot print it. Human output shows the rest of the API error as indented field/value lines rather than a JSON line, including fields beside the error such as a request ID, and keeps the reason when the message does not carry it. --json still reports the complete response. The payments guide shows the quote-then-receive flow a USD wallet needs.
thebrandonlucas
force-pushed
the
feat/cli-error-hints
branch
from
October 20, 2026 13:01
a9590c7 to
ebd905a
Compare
tee8z
self-requested a review
October 20, 2026 14:07
tee8z
approved these changes
Oct 20, 2026
This was referenced Oct 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack: master ← #24 ← #19 ← #26 ← #27 ← #28 ← #29 ← #30 ← #55 ← #59. #20, #22 and #57 are merged.
Errors now name the next command, not only the problem:
--org,--env,--wallet, or webhook IDVOLTAGE_*variable, profile)invalid_grant)voltage logout --local --account NAME, thenvoltage login --account NAMEorganizations list/environments listwith an API keyvoltage auth status, or sign in againvoltage context, to check the organization, environment, and credential--token-file,VOLTAGE_CHECKOUT_TOKEN, orVOLTAGE_STREAM_TOKENquote_requiredvoltage quotes create; a wallet on a BTC line of credit needs no quoteTwo changes to how API errors print:
Voltage API returned HTTP 400: Quote is required for payment. A 5xx message gives only the status, and its text stays in the details. The credentials the CLI presented are redacted from the message as well as the details.field valuelines instead of one JSON line.--jsonstill reports the complete response.Credential hints are attached in
CredentialProblem::error, sovoltage contextand commands share one selection path. Hints can now be built at runtime and are scrubbed like messages, because they can name saved credentials and profiles.docs/reference/exit-codes.mdlists them.The
--yesrefusal hint from the original plan is dropped: #14 replaced confirmation prompts with--execute, and the not-executed error already names--executeandVOLTAGE_EXECUTE=1.Changes after review
HTTP 400: Bad key <key>.Error::redactednow redactsmessagetoo. New integration tests check a 400 whoseerror.detailechoes the key, in--jsonand in human output, and a 5xx whose text stays out of the message.send, intoApiErrorBody::messageandApiErrorBody::hint.quote_requiredhint no longer claims to know the wallet: "A wallet on a USD line of credit needs a quote for each payment."bound_elsewhere,empty_api_key, unknown profile with saved profiles,profiles getandprofiles deletewith an unknown name, the--webhookpath hint, and the--envhint with no and with two--envvalues.docs/reference/exit-codes.mdsays "Many errors" carry a hint and gives the logout-then-login order.Open question
Logins are saved under the account's email address by default, so the "Saved credentials: …" hints print saved emails to stderr and in
--jsonerror.hint, which can end up in CI logs. This PR leaves that behavior as it is. Is that intended?Checks
On
ebd905a:cargo fmt --check,cargo clippy --locked --all-targets -- -D warnings,cargo machete --with-metadata: pass.cargo test --locked: 97 unit and 82 integration tests pass.VOLTAGE_BLESS=1 cargo test --lockedleaves the tree clean.python3 scripts/check-coverage.py: pass.scripts/crap-report.sh): no function at or above 20. Highest isapi::wait_for_paymentat 19.66, unchanged from or lower than master (19.66).voltage-pr-reviewand thevoltage-backend-engineeringRust checklist, against the stack base. Findings are fixed in this commit.Not run: the staging and live tutorials, which need credentials.